package com;

import com.gen.MbpGeneratorHead;
import com.gen.config.MbpGeneratorConfig;
import com.gen.MbpGeneratorItem;

import javax.swing.*;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: Cxx
 * @Version 1.0
 * @create: 2025-10-01 20:05
 * @description:
 **/
public class Generator {
    /**
     * 数据源
     */
    private static final String JDBC_URL = "jdbc:kingbase8://ip地址:端口号/数据库名称?currentSchema=数据库Schema&characterEncoding=UTF-8";

    /**
     * 驱动类名
     */
    private static final String DRIVER_CLASS_NAME = "com.kingbase8.Driver";

    /**
     * 用户名
     */
    private static final String USERNAME = "用户名称";

    /**
     * 密码
     */
    private static final String PASSWORD = "密码";

    /**
     * 父包名
     */
    private static final String PARENT = "generator";

    /**
     * 模块名
     */
    private static final String MODULE_NAME = "";

    /**
     * 头表表名称
     */
    private static final String HEAD_TABLE = "biz_sc_sp_purchase_plan_head";

    /**
     * 分录表名
     */
    private static final List<String> ITEM_TABLES = new ArrayList<>(
            List.of("biz_sc_sp_purchase_plan_item"));

    /**
     * 表前缀
     */
    private static final String TABLE_PREFIX = "biz_sc_";

    /**
     * 作者
     */
    private static final String AUTHOR = "cxx";

    public static void main(String[] args) {
        MbpGeneratorConfig config = MbpGeneratorConfig.builder()
                .jdbcUrl(JDBC_URL)
                .driverClassName(DRIVER_CLASS_NAME)
                .username(USERNAME)
                .password(PASSWORD)
                .headTableName(HEAD_TABLE)
                .itemTableNames(ITEM_TABLES)
                .tablePrefix(TABLE_PREFIX)
                .parent(PARENT)
                .moduleName(MODULE_NAME)
                .author(AUTHOR).build();
        new MbpGeneratorItem(config).generator().execute();
        new MbpGeneratorHead(config).generator().execute();
    }

}
